﻿using System.ComponentModel.DataAnnotations;
using YFurion.Application;

namespace UpperComputer.Base.SystemApplication
{
    public class DataDictionaryDto : EntityDto
    {
        [Required(ErrorMessage = "数据字典编码不能为空"), RegularExpression(@"^[A-Z][a-zA-Z]{1,49}$", ErrorMessage = "数据字典编码格式不正确")]
        public string Code { get; set; }

        [Required(ErrorMessage = "数据字典名称不能为空"), StringLength(50, ErrorMessage = "数据字典名称不能超过50个字符")]
        public string DisplayName { get; set; }

        [RegularExpression(@"^[A-Z][a-zA-Z]{1,49}$", ErrorMessage = "父级编码格式不正确")]
        public string ParentCode { get; set; } = string.Empty;

        [StringLength(50, ErrorMessage = "数据字典值不能超过50个字符")]
        public string Value { get; set; }

        [Range(1, byte.MaxValue, ErrorMessage = "序号必须在1-255之间")]
        public int Sort { get; set; }
    }
}
